#include "ParticleVictoryDestroyAll.h"

#include "ParticleContext.h"
#include "DescriptorParticle.h"

#include "VictoryConditions.h"

using namespace ParticleEngine;

const DescriptorParticle ParticleVictoryDestroyAll::Descriptor
(
"VictoryDestroyAll",
[](ParticleContext& NewContext){ return new ParticleVictoryDestroyAll(NewContext); }
);

ParticleVictoryDestroyAll::ParticleVictoryDestroyAll(ParticleContext& NewContext) :
ParticleBase(NewContext, &ParticleVictoryDestroyAll::Descriptor),
Active(false)
{
	Adhesions = new PropertyAdhesions(0.1f);
	Adhesions->ParticleCast = this;
}
ParticleVictoryDestroyAll::~ParticleVictoryDestroyAll(void)
{
}

ColorRGBA<unsigned char> ParticleVictoryDestroyAll::GetColor()
{
	return ColorRGBA<unsigned char>(128, 128, 64, 255);
}

void ParticleVictoryDestroyAll::Sole()//einzelne aktualisierzung
{
	this->SoleStandard();

	if (this->Active == false)
	{
		if (Adhesions->AdhesionCount < 6)
		{
			this->Active = true;
			Context.Victory.DestroyAllReleased();
		}
	}
}